<!-- html -->
<template>
  <span class="span2">内容：{{ text }}</span>
  <button class="button1" @click="changeText">修改内容</button>
</template>

<!-- js或ts -->
<script lang="ts">
export default {
  name: 'exposeTest2Child2'
}
</script>

<!-- js或ts -->
<script setup lang="ts">
import { ref } from 'vue'
//数据
let text = ref('world')
//方法
//向外部提供属性
defineExpose({ text })
function changeText() {
  text.value += '-'
}
</script>

<!-- 样式 -->
<style scoped></style>